<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<body>
<div class="pull-left">
    <div class="form-group form-inline pull-left">
        总共${pageInfo.pages} 页，共${pageInfo.total} 条数据。
        <div class="form-group form-inline">
            每页
            <select id="selectPage" onchange="goPage(${1})" class="form-control">
                <option ${pageInfo.pageSize=='5' ? 'selected':''}value="5">5</option>
                <option ${pageInfo.pageSize=='10' ? 'selected':''} value="10">10</option>
                <option ${pageInfo.pageSize=='15' ? 'selected':''} value="15">15</option>
                <option ${pageInfo.pageSize=='20' ? 'selected':''} value="20">20</option>
                <option ${pageInfo.pageSize=='50' ? 'selected':''} value="50">50</option>
                <option ${pageInfo.pageSize=='80' ? 'selected':''} value="80">80</option>
            </select> 条
        </div>
    </div>
</div>

<div class="box-tools pull-right">
    <div class="box-tools pull-left">
    <ul class="pagination" style="margin: 0px;">
        <li >
            <a href="javascript:goPage(1)" aria-label="Previous">首页</a>
        </li>
        <li><a href="javascript:goPage(${pageInfo.prePage})">上一页</a></li>
        <c:forEach begin="${pageInfo.navigateFirstPage}"
                   end="${pageInfo.navigateLastPage}" var="i">
            <li class="paginate_button ${pageInfo.pageNum==i ? 'active':''}"><a href="javascript:goPage(${i})">${i}</a></li>
        </c:forEach>
        <li><a href="javascript:goPage(${pageInfo.nextPage})">下一页</a></li>
        <li>
            <a href="javascript:goPage(${pageInfo.pages})" aria-label="Next">尾页</a>
        </li>
    </ul>
    </div>
    <div class="input-group" style="width: 170px;height: 34px;">
        <input id="pageText" type="text" class="form-control" placeholder="输入页码">
        <span class="input-group-btn">
        <button onclick="goPageToPage()" class="btn btn-default" type="button">Go!</button>
      </span>
    </div>
</div>
<form id="pageForm" action="${param.pageUrl}" method="post">
    <input type="hidden" name="pageNum" id="pageNum">
    <input type="hidden" name="pageSize" id="pageSize">
</form>
<script>
    function goPage(page) {
        var pageSize = document.getElementById("selectPage").value;
        document.getElementById("pageSize").value=pageSize;
        document.getElementById("pageNum").value = page;
        document.getElementById("pageForm").submit();
    }
    function goPageToPage() {
        var pageSize = document.getElementById("pageText").value;
        if(pageSize) {
            goPage(pageSize);
        }
    }
</script>
</body>
</html>
